package com.example.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 消息表
 * </p>
 *
 * @author yzy
 * @since 2025-08-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Message对象", description = "消息表")
public class Message implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "消息表主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "接收者用户ID")
    private Integer userId;

    @ApiModelProperty(value = "消息体")
    private String content;

    @ApiModelProperty(value = "是否已经阅读")
    private Boolean isRead;

    @ApiModelProperty(value = "发送时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 临时字段
     * 通过用户名/用户账号获取到相应用户id
     **/
    @TableField(exist = false)
    private String userName;
    @TableField(exist = false)
    private String userAccount;

}
